package cn.com.cifi.mars.entity;

import com.baomidou.mybatisplus.annotation.IdType;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.minidev.json.annotate.JsonIgnore;

/**
 * <p>
 * 回款系数详情表
 * </p>
 *
 * @author JingYuanXiang
 * @since 2020-11-05
 */
@Data
@TableName("t_return_coefficient_detail")
public class ReturnCoefficientDetail implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.INPUT)
    private String id;

    @TableField(exist = false,value = "项目id" )
    private String projectId;

    @ApiModelProperty(value = "回款系数关联版本ID")
    private String coefficientId;

    @ApiModelProperty(value = "产品构成父级编码")
    private String proProductCode;

    @ApiModelProperty(value = "产品构成父级名称")
    private String proProductType;

    @ApiModelProperty(value = "业态（住宅，商墅，车位）编码")
    private String threeProductCode;
    @ApiModelProperty(value = "业态（住宅，商墅，车位）名称")
    private String threeProductName;

    @ApiModelProperty(value = "签约回款率")
    private BigDecimal signingRate;

    @ApiModelProperty(value = "首次签约日期")
    private LocalDateTime dateInitialSigning;

    @ApiModelProperty(value = "套数去化率")
    private BigDecimal suiteSellingRate;

    @ApiModelProperty(value = "生效日期")
    private LocalDateTime effectiveDate;

    @ApiModelProperty(value = "第一月")
    private BigDecimal oneMonth;

    @ApiModelProperty(value = "第二月")
    private BigDecimal twoMonth;

    @ApiModelProperty(value = "第三月")
    private BigDecimal threeMonth;

    @ApiModelProperty(value = "第四月")
    private BigDecimal fourMonth;

    @ApiModelProperty(value = "第五月")
    private BigDecimal fiveMonth;

    @ApiModelProperty(value = "第六月")
    private BigDecimal sixMonth;

    @ApiModelProperty(value = "第七月")
    private BigDecimal sevenMonth;

    @ApiModelProperty(value = "第八月")
    private BigDecimal eightMonth;

    @ApiModelProperty(value = "第九月")
    private BigDecimal nineMonth;

    @ApiModelProperty(value = "第十月")
    private BigDecimal tenMonth;

    @ApiModelProperty(value = "第十一月")
    private BigDecimal elevenMonth;

    @ApiModelProperty(value = "第十二月")
    private BigDecimal twelveMonth;

    @ApiModelProperty(value = "第十三月")
    private BigDecimal thirteenMonth;

    @ApiModelProperty(value = "第十四月")
    private BigDecimal fourteenMonth;

    @ApiModelProperty(value = "第十五月")
    private BigDecimal fifteenMonth;

    @ApiModelProperty(value = "第十六月")
    private BigDecimal sixteenMonth;

    @ApiModelProperty(value = "第十七月")
    private BigDecimal seventeenMonth;

    @ApiModelProperty(value = "第十八月")
    private BigDecimal eighteenMonth;

    @ApiModelProperty(value = "第十九月")
    private BigDecimal nineteenMonth;

    @ApiModelProperty(value = "第二十月")
    private BigDecimal twentyMonth;

    @ApiModelProperty(value = "第二十一月")
    private BigDecimal twentyOneMonth;

    @ApiModelProperty(value = "第二十二月")
    private BigDecimal twentyTwoMonth;

    @ApiModelProperty(value = "第二十三月")
    private BigDecimal twentyThreeMonth;

    @ApiModelProperty(value = "第二十四月")
    private BigDecimal twentyFourMonth;

    @ApiModelProperty(value = "第二十五月")
    private BigDecimal twentyFiveMonth;

    @ApiModelProperty(value = "第二十六月")
    private BigDecimal twentySixMonth;

    @ApiModelProperty(value = "第二十七月")
    private BigDecimal twentySevenMonth;

    @ApiModelProperty(value = "第二十八月")
    private BigDecimal twentyEightMonth;

    @ApiModelProperty(value = "第二十九月")
    private BigDecimal twentyNineMonth;

    @ApiModelProperty(value = "第三十月")
    private BigDecimal thirtyMonth;

    @ApiModelProperty(value = "第三十一月")
    private BigDecimal thirtyOneMonth;

    @ApiModelProperty(value = "第三十二月")
    private BigDecimal thirtyTwoMonth;

    @ApiModelProperty(value = "第三十三月")
    private BigDecimal thirtyThreeMonth;

    @ApiModelProperty(value = "第三十四月")
    private BigDecimal thirtyFourMonth;

    @ApiModelProperty(value = "第三十五月")
    private BigDecimal thirtyFiveMonth;

    @ApiModelProperty(value = "第三十六月")
    private BigDecimal thirtySixMonth;

    @ApiModelProperty(value = "创建人员")
    private String createBy;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新人员")
    private String updateBy;

    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "是否删除")
    private Integer isDelete;

    @ApiModelProperty(value = "备注说明")
    private String description;

    public Map<Integer, Object> getCoefficientOneMap() {
        Map<Integer, Object> coefficientMap = new HashMap<>();
        coefficientMap.put(1,this.getOneMonth());
        coefficientMap.put(2,this.getTwoMonth());
        coefficientMap.put(3,this.getThreeMonth());
        coefficientMap.put(4,this.getFourMonth());
        coefficientMap.put(5,this.getFiveMonth());
        coefficientMap.put(6,this.getSixMonth());
        coefficientMap.put(7,this.getSevenMonth());
        coefficientMap.put(8,this.getEightMonth());
        coefficientMap.put(9,this.getNineMonth());
        coefficientMap.put(10,this.getTenMonth());
        coefficientMap.put(11,this.getElevenMonth());
        coefficientMap.put(12,this.getTwelveMonth());
        coefficientMap.put(13,this.getThirteenMonth());
        coefficientMap.put(14,this.getFourteenMonth());
        coefficientMap.put(15,this.getFifteenMonth());
        coefficientMap.put(16,this.getSixteenMonth());
        coefficientMap.put(17,this.getSeventeenMonth());
        coefficientMap.put(18,this.getEighteenMonth());
        coefficientMap.put(19,this.getNineteenMonth());
        coefficientMap.put(20,this.getTwentyMonth());
        coefficientMap.put(21,this.getTwentyOneMonth());
        coefficientMap.put(22,this.getTwentyTwoMonth());
        coefficientMap.put(23,this.getTwentyThreeMonth());
        coefficientMap.put(24,this.getTwentyFourMonth());
        return coefficientMap;
    }

    public Map<Integer, BigDecimal> getCoefficientTwoMap() {
        Map<Integer, BigDecimal> coefficientMap = new HashMap<>();
        coefficientMap.put(1,this.getOneMonth());
        coefficientMap.put(2,this.getTwoMonth());
        coefficientMap.put(3,this.getThreeMonth());
        coefficientMap.put(4,this.getFourMonth());
        coefficientMap.put(5,this.getFiveMonth());
        coefficientMap.put(6,this.getSixMonth());
        coefficientMap.put(7,this.getSevenMonth());
        coefficientMap.put(8,this.getEightMonth());
        coefficientMap.put(9,this.getNineMonth());
        coefficientMap.put(10,this.getTenMonth());
        coefficientMap.put(11,this.getElevenMonth());
        coefficientMap.put(12,this.getTwelveMonth());
        coefficientMap.put(13,this.getThirteenMonth());
        coefficientMap.put(14,this.getFourteenMonth());
        coefficientMap.put(15,this.getFifteenMonth());
        coefficientMap.put(16,this.getSixteenMonth());
        coefficientMap.put(17,this.getSeventeenMonth());
        coefficientMap.put(18,this.getEighteenMonth());
        coefficientMap.put(19,this.getNineteenMonth());
        coefficientMap.put(20,this.getTwentyMonth());
        coefficientMap.put(21,this.getTwentyOneMonth());
        coefficientMap.put(22,this.getTwentyTwoMonth());
        coefficientMap.put(23,this.getTwentyThreeMonth());
        coefficientMap.put(24,this.getTwentyFourMonth());
        return coefficientMap;
    }


    /**
     * 初始化第24月系数
     */
    public void initializeTwentyFourMonth(){
        this.twentyFourMonth = new BigDecimal(1)
                .subtract(this.oneMonth)
                .subtract(this.twoMonth)
                .subtract(this.threeMonth)
                .subtract(this.fourMonth)
                .subtract(this.fiveMonth)
                .subtract(this.sixMonth)
                .subtract(this.sevenMonth)
                .subtract(this.eightMonth)
                .subtract(this.nineMonth)
                .subtract(this.tenMonth)
                .subtract(this.elevenMonth)
                .subtract(this.twelveMonth)
                .subtract(this.thirteenMonth)
                .subtract(this.fourteenMonth)
                .subtract(this.fifteenMonth)
                .subtract(this.sixteenMonth)
                .subtract(this.seventeenMonth)
                .subtract(this.eighteenMonth)
                .subtract(this.nineteenMonth)
                .subtract(this.twentyMonth)
                .subtract(this.twentyOneMonth)
                .subtract(this.twentyTwoMonth)
                .subtract(this.twentyThreeMonth);
    }
}
